<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ include file="/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/cases/source/";  //应用的地址名
String listActionName = basePath+"CaseSource.action?op=searchjs";
String addActionName = basePath+"CaseSource_add.action";
String editActionName = basePath+"CaseSource_modify.action";
String delActionName = basePath+"CaseSource_del.action?op=deljs";
String lookActionName = basePath+"CaseSource.action?op=look";
String flowPageActionName = basePath+"CaseSource_caseSourceFlowPage.action";
String goBackActionName = basePath+"CaseSource_caseSourceGoBack.action";
String handOverActionName = basePath+"CaseSource_caseSourceHandOver.action";
String showCaseSourceFileActionName = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/cases/check/CaseSourceCheck_showCaseSourceFile.action";

String chkId=request.getParameter("chkSelf");
%>

<html>
<head>
<title>jQuery EasyUI</title>
	<script type="text/javascript" src="<%=path %>/cases/main.js"></script>
	<script>
	var chkId='<%=chkId%>';
    $(function(){
	   $('a.easyui-linkbutton').linkbutton('enable');
	   $('#childMenuTree').tree({
		    url:'<%=path%>/cases/source/CaseSource_wsTree.action?vcRecordId=<%=chkId%>',
		    onClick: function(node){		    	
				addChildTab(node.text,'<%=showCaseSourceFileActionName%>?vcFileId='+node.id+'&fileName='+node.text);
			}
	   });
	});
	function addChildTab(subtitle,url){
	if(!$('#opCaseTabs').tabs('exists',subtitle)){
		$('#opCaseTabs').tabs('add',{
			title:subtitle,
			content:createFrame(url),
			closable:true
		});
	}else{
		$('#opCaseTabs').tabs('select',subtitle);		
	}	
}
	//移交
	function handOver(){
		
		addChildTab('移交','<%=handOverActionName%>');
	}
	//签收
	function receive(){
		$.post("<%=path%>/cases/source/CaseSource_caseSourceReceiveSuccess.action",
				 {
			 		chkSelf:'<%=chkId%>'			 		
			 	},
		 		function(data){
		    try{
		            jsonReStr = jQuery.parseJSON(data);  //获取从服务器得到的数据反馈信息
		            if(jsonReStr.opState=="success"){    //操作成功处理
			            $.util.showTip({content:jsonReStr.opInfo});			            
		            }else if(jsonReStr.opState=="failure"){  //操作失败处理
		                $.messager.alert('消息提示','签收失败！原因如下：<br><font color=red>'+jsonReStr.opInfo+'</font>','error');
		            }
	            }catch(e){
	               $.messager.alert('消息提示','出现系统错误!可能原因如下：<br><font color=red>'+this.url+'页面地址未找到！或'+e+'</font>','error');
	            }
		 });//重置密码操作
	}
	//回退
	function goBack(){
		addChildTab('回退','<%=goBackActionName%>?chkSelf=<%=chkId%>');
	}
	function caseSourceFlowPage(){
		addChildTab('流程查看','<%=flowPageActionName%>?chkSelf=<%=chkId%>');
	}
	
	//打开待办页面
//	function pendingItems(id){
////		var rows = $('#searchTable').datagrid('getSelections');	
//		var num=rows[0].taxpayerNumber;
	//}
	

function createFrame(url)
{
	var s = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';
	return s;
}
	</script>
</head>
<body class="easyui-layout">
	<div region="north" border="false" style="height:50px;">
	    <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-up" onclick="handOver();">移交</a>
	    <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-up" onclick="receive();">签收</a>
		<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-undo" onclick="goBack();">回退</a>
		<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-issued" onclick="caseSourceFlowPage();">查看流程</a>
		<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-reload" onclick="caseSourceFlowPage();">待办任务</a>
		<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-invalid">大要案</a>
		<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-search">案卷查询</a>

	</div>
	<div region="west" split="true" title="多元菜单树" style="width:200px;padding:10px;">
     <ul id="childMenuTree" class="tree"> 
		 
	 </ul>
	</div>
	<div region="center">
	   <div id="opCaseTabs" class="easyui-tabs" fit="true" border="false">
			<div title="案源信息">
					  <iframe id="desktop" src="<%=lookActionName %>&chkSelf=<%=chkId %>" scrolling="auto" frameborder="0" style="width:100%;height:100%;">
					  
					  </iframe>
			</div>		
		</div>
	</div>
</body>
</html>

